From a9d25d6235651d3c64741a979c4241f2f10763ba Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 24 Dec 2006 06:32:07 +0000 Subject: [PATCH] When shift-clicking, keep the larger part of the selection selected. 2006-12-24 Matthias Clasen * gtk/gtkentry.c (gtk_entry_button_press): When shift-clicking, keep the larger part of the selection selected. (#353709, Benjamin Otte) * gtk/gtkbutton.c (gtk_button_get_props): Use gtk_border_free when freeing borders. --- ChangeLog | 7 +++++++ gtk/gtkbutton.c | 6 +++--- gtk/gtkentry.c | 9 ++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28c61f9d09..17388abee1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2006-12-24 Matthias Clasen + * gtk/gtkentry.c (gtk_entry_button_press): When + shift-clicking, keep the larger part of the selection + selected. (#353709, Benjamin Otte) + + * gtk/gtkbutton.c (gtk_button_get_props): Use + gtk_border_free when freeing borders. + * gtk/gtkbutton.c (gtk_button_grab_notify): Be more careful when faking a button release. (#323146, Travis Abbott) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 002241ce10..2b0ad37c00 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -1057,7 +1057,7 @@ gtk_button_get_props (GtkButton *button, if (tmp_border) { *default_border = *tmp_border; - g_free (tmp_border); + gtk_border_free (tmp_border); } else *default_border = default_default_border; @@ -1070,7 +1070,7 @@ gtk_button_get_props (GtkButton *button, if (tmp_border) { *default_outside_border = *tmp_border; - g_free (tmp_border); + gtk_border_free (tmp_border); } else *default_outside_border = default_default_outside_border; @@ -1083,7 +1083,7 @@ gtk_button_get_props (GtkButton *button, if (tmp_border) { *inner_border = *tmp_border; - g_free (tmp_border); + gtk_border_free (tmp_border); } else *inner_border = default_inner_border; diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 30d388e389..c5ade49565 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1665,8 +1665,11 @@ gtk_entry_button_press (GtkWidget *widget, if (tmp_pos > sel_start && tmp_pos < sel_end) { - /* Truncate current selection */ - gtk_entry_set_positions (entry, tmp_pos, -1); + /* Truncate current selection, but keep it as big as possible */ + if (tmp_pos - sel_start > sel_end - tmp_pos) + gtk_entry_set_positions (entry, sel_start, tmp_pos); + else + gtk_entry_set_positions (entry, tmp_pos, sel_end); } else { @@ -3608,7 +3611,7 @@ gtk_entry_find_position (GtkEntry *entry, PangoLayoutLine *line; gint index; gint pos; - gboolean trailing; + gint trailing; const gchar *text; gint cursor_index; -- 2.30.2